package com.lonni.rpc.core.model;

import com.lonni.rpc.core.spring.YAMLPropertySourceFactory;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.io.Serializable;

/**
 * rpc全局配置类
 *
 * @author: Lonni
 * @date: 2024/7/9 0009 16:23
 */
@Configuration
@ConfigurationProperties(prefix = "rpc")
@PropertySource(value = "classpath:config/application-rpc.yml",factory = YAMLPropertySourceFactory.class)
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class RpcConfig implements Serializable {

    /**
     * 负载均衡方式
     *  random 随机
     *  queue 轮询
     * @see com.lonni.rpc.core.commom.BalanceType
     */
    private String balance;

    /**
     * 序列化方式
     */
    private String serializable;

    /**
     * netty配置
     */
    private RpcNettyProperties netty;
    /**
     * zookeeper 配置
     */
    private ZkConfig zookeeper;

    public String getBalance() {
        return balance;
    }

    public void setBalance(String balance) {
        this.balance = balance;
    }

    public String getSerializable() {
        return serializable;
    }

    public void setSerializable(String serializable) {
        this.serializable = serializable;
    }

    public RpcNettyProperties getNetty() {
        return netty;
    }

    public void setNetty(RpcNettyProperties netty) {
        this.netty = netty;
    }

    public ZkConfig getZookeeper() {
        return zookeeper;
    }

    public void setZookeeper(ZkConfig zookeeper) {
        this.zookeeper = zookeeper;
    }
}



